package com.cimpm.permission.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.hby.common.annotation.Remind;
import com.hby.common.annotation.entity.AllowEdit;
import com.hby.common.annotation.entity.AllowNull;
import com.hby.common.annotation.entity.VerifyMultiRepetitionField;

import java.util.Date;

@Remind("原则上只做增删不做修改;" +
        "default权限不加，逻辑里自查无高级权限即为default")
@TableName("permission_data_permission")
public class DataPermission {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @TableField(value = "`name`")
    @VerifyMultiRepetitionField
    @AllowEdit
    private String name;

    @Remind("对应DataPermissionType")
    @TableField(value = "`type`")
    @VerifyMultiRepetitionField
    private Integer type;

    @Remind("未启用，用于区分同一个类型下权限的高低")
    @AllowNull
    private Integer priority;

    @TableLogic
    @TableField(value = "`is_deleted`")
    private Date isDeleted;

    @Version
    @TableField(value = "`version`")
    private Integer version;

    @Override
    public String toString() {
        return "DataPermission{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type=" + type +
                ", priority=" + priority +
                ", isDeleted=" + isDeleted +
                ", version=" + version +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Date getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Date isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }
}
